﻿using System;
using System.Net;
using System.Net.Mail;
using System.Text;
using System.Web;

using NUnit.Framework;

namespace octalforty.Staytuned.Tests
{
    [TestFixture]
    public class MailAddressTestFixture
    {
        [Test]
        public void Parse()
        {
            var mailAddress = 
                new MailAddress("support@supportyapp.com", "антон гоголев", Encoding.Unicode);
                //new MailAddress(address,);
            Console.WriteLine(mailAddress);

            var smtp = new SmtpClient("smtp.gmail.com", 587) {
                DeliveryMethod = SmtpDeliveryMethod.Network,
                EnableSsl = true,
                Credentials = new NetworkCredential("support@supportyapp.com", "Q!w2E#r4T%")
            };

            var @from = "\"John \\\"Jr\\\" Doe\" <support@supportyapp.com>".Replace("\"", "");
            Console.WriteLine(@from);
            smtp.Send(new MailMessage(@from, "anton.gogolev@gmail.com")
                      {
                          Body = "Test", Subject = "Test"
                      });
        }
    }
}
